(function(window) {

	function initcomponents() {

		/**
		 * fonts & css styles
		 */
		loadStyle('../css/bootstrap/css/bootstrap.css');
		loadStyle('http://fonts.googleapis.com/css?family=Yesteryear');
		loadStyle('http://fonts.googleapis.com/css?family=Henny+Penny');
		loadStyle('http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css');
		/* slider */
		loadStyle('../css/slider/color/style.css');
		/* accordion */
		loadStyle('../css/accordion/accordion.css');

		/**
		 * utils
		 */
		loadScript('http://code.jquery.com/jquery-1.8.2.js');
		loadScript('http://code.jquery.com/ui/1.9.1/jquery-ui.js');
		loadScript('../js/controller/utils/constants.js');
		loadScript('../js/controller/utils/generalutils.js');
		loadScript('../js/controller/utils/imageutils.js');

		/**
		 * model
		 */
		loadScript('../js/model/component.js');
		loadScript('../js/model/cimage.js');
		loadScript('../js/model/ctext.js');

		/**
		 * controllers
		 */
		loadScript('../js/controller/gridcontroller.js');
		loadScript('../js/controller/tshirtcontroller.js');
		loadScript('../js/controller/drawcontroller.js');

		/**
		 * components
		 */
		/*  */

	}

	function loadScript(url, callback) {

		// adding the script tag to the head as suggested before
		var head = document.getElementsByTagName('head')[0];
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.src = url;

		// then bind the event to the callback function
		// there are several events for cross browser compatibility
		script.onreadystatechange = callback;
		script.onload = callback;

		// fire the loading
		head.appendChild(script);
	}

	function loadStyle(url, callback) {

		// adding the script tag to the head as suggested before
		var head = document.getElementsByTagName('head')[0];
		var script = document.createElement('link');
		script.type = 'text/css';
		script.href = url;
		script.rel = 'stylesheet';

		// then bind the event to the callback function
		// there are several events for cross browser compatibility
		script.onreadystatechange = callback;
		script.onload = callback;

		// fire the loading
		head.appendChild(script);
	}

	window.initcomponents = initcomponents;
})(window);

/**
 * post call
 */
setTimeout(function() {
	loadSizeSlider();
	loadColorSlider();
	loadAccordion();
}, 1000);